package com.gears_software.sxdc.dccx.data.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.gears_software.sxdc.dccx.data.model.TransactionRecord;
import com.gears_software.sxdc.dccx.ui.view.LiuShuiListItemView;
import com.gears_software.sxdc.dccx.ui.view.LiuShuiListItemView_;

import java.util.HashMap;
import java.util.List;

/**
 * Created by SunMuran on 2017/8/4.
 */

public class LiuShuiListAdapter extends BaseAdapter {
    Context context;
        List<TransactionRecord> list;

    public LiuShuiListAdapter(Context context, List< TransactionRecord> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LiuShuiListItemView itemView  = null;

        if (convertView == null) {
            itemView = LiuShuiListItemView_.build(context);
        } else {
            itemView = (LiuShuiListItemView) convertView;
        }

        itemView.bind(list.get(position));
        return itemView;
    }
}
